<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
require(dirname(__FILE__).'/params.php');

return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'language'=>$params['appLan'],
	'charset'=>'utf-8',
	'name'=>'JCAuth',
	'defaultController'=>'site',
	'charset'=>'utf-8',
	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
	),

	'modules'=>array(
		// uncomment the following to enable the Gii tool
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'123',
		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
	),

	// application components
	'components'=>array(
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		
		// uncomment the following to enable URLs in path-format
		/*
		//用auth文件作为权限控制器
		'authManager' => array(
			'class' => 'PhpAuthManager',
			'defaultRoles' => array('guest'),
		),
		*/
		
		//用数据库文件作为权限控制器
		'authManager'=>array(
			// The type of Manager (Database)
			'class'=>'CDbAuthManager',
			// The database component used
			'connectionID'=>'db',
			// AuthItem 这是所有校验成员的数据表,包括 operation , task , role
			'itemTable'=>'{{authitem}}',
			// AuthAssignment 此表描述了用户的角色属性,关于userid部分,如果你使用的是用户名,则可以自行修改字段类型以适应你的需求
			'assignmentTable'=>'{{authassignment}}',
			// AuthItemChild 此表描述了 operation , task , role 之间从属的关系
			'itemChildTable'=>'{{authitemchild}}',
			'defaultRoles'=>array('Guest'),
		),
		/*
		'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false,
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),
		*/
		
		'db'=>require(dirname(__FILE__).'/db.php'),
		// uncomment the following to use a MySQL database
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),
		
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				array(
					'class'=>'CWebLogRoute',
					'enabled'=>false,
				),
				/*
				//数据库记录日志
				array(
					'class'=>'CDbLogRoute',
					'autoCreateLogTable'=>true,
					'categories'=>'system.*',
					'connectionID'=>'db',
					'enabled'=>true,
					'logTableName'=>'history',
					
				),
				*/
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
	),
);
